#include<bits/stdc++.h>
#define int long long
using namespace std;
int T;
int f(int x){
    x/=2;
    int l=0,r=1e9,z=0;
    while(l<=r){
        int mid=(l+r)/2;
        if((1+mid)*mid*2<x) z=mid,l=mid+1;
        else r=mid-1;
    }
    return z*4+3+(x-(1+z)*z*2+z)/(z+1);
}
void sol(){
    int x;
    scanf("%lld",&x);
    if(x==0) printf("2\n");
    else if(x&1) printf("%lld\n",((int)sqrt(x-1))*2+3);
    else printf("%lld\n",f(x));
}
signed main(){
    freopen("tree.in","r",stdin);
    freopen("tree.out","w",stdout);
    scanf("%lld",&T);
    while(T--) sol();
    return 0;
}